package com.pavco.caribbeanvisit.client.ui;

import java.util.ArrayList;

import com.google.gwt.maps.client.InfoWindow;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Overlay;
import com.google.gwt.user.client.ui.Composite;

public class PavcoMap extends Composite {
  private MapWidget map;
  private ArrayList <Overlay> overlayList = new ArrayList<Overlay> ();

  public PavcoMap() {
    LatLng caribCentre = LatLng.newInstance(16.233135,-72.388916);
    map = new MapWidget(caribCentre, 5);
    map.setSize("700px", "400px");
    map.addControl(new LargeMapControl());
    initWidget(map);
  }
  
  public void addOverlay(Overlay o) {
    map.addOverlay(o);
    overlayList.add(o);
  }
  
  public void removeOverlay(Overlay o) {
    map.removeOverlay(o);
    overlayList.remove(o);
  }
  
  public void hideOverlay(Overlay o) {
    map.removeOverlay(o);
  }
  
  public void showOverlay(Overlay o) {
    map.addOverlay(o);
  }
  
  public ArrayList<Overlay> getOverlays() {
    return overlayList;
  }
  
  public void adjustSize(String width, String height) {
    this.map.setSize(width, height);
  }
  
  public InfoWindow getInfoWindow() {
    return this.map.getInfoWindow();
  }
  
  public void setCenter(LatLng center) {
    this.map.setCenter(center);
  }
}